<?php
/* @var $this UserController */
/* @var $model User */

$this->breadcrumbs=array(
	'Anggota'=>array('user/semua'),
	'BPH',
);

$this->pageTitle=Yii::app()->name . " - BPH UKM BIMBEL STIS";

?>

<div class="kolom-1">
	<h1 class="judul-halaman">BPH UKM BIMBEL STIS PERIODE <?php echo Kepengurusan::model()->findByPk(Tahunaktif::model()->findByPk(1)->kepengurusan_id)->kepengurusan; ?></h1>
	<div class="latar-putih">
	<?php if(count($modelBPH)==0) echo "<i>Tidak Ditemukan Hasil</i>"; ?>
	<?php foreach($modelBPH as $id => $model): ?>
		<div align="center"><h2 class="agencyr"><?php echo Jabatan::model()->findByPk($model->jabatan_id)->jabatan; ?></h2></div>
		<?php $user = User::model()->findByPk($model->user_id); ?>
		<div class="kolom-2-kiri-sedikit" align="center">
			<div class="foto-profil">
			<img src="<?php echo $user->foto==null ? Yii::app()->request->baseUrl.'/images/profil/default.png' : Yii::app()->request->baseUrl.'/images/profil/'.$user->foto.''; ?>" alt="Foto Profil Tidak Diset" />
			
			</div>
		</div>
		<div class="kolom-2-kanan-banyak">
			<table class="profil">
				<tr>
					<td>Nama Lengkap</td><td>: <?php echo $user->nama; ?></td>
				</tr>
				<tr>
					<td>Riwayat Kelas</td><td>: <?php 
						$dbh=Yii::app()->db;
						$sql="select kelas_id from riwayatkelas where user_id=".$user->id." order by kelas_id";
						$command=$dbh->createCommand($sql);
						$reader=$command->query();
						$arraykelas = array();
						if($reader->getRowCount()!=0){
							while(($row=$reader->read())!==false){
								$arraykelas[] = Kelas::model()->findByPk($row['kelas_id'])->kelas;
							}
							sort($arraykelas);
							foreach($arraykelas as $kelas){
								echo $kelas.", ";
							}
						}else{
							echo "<span class='null'>Tidak diset</span>";
						}
					?></td>
				</tr>
				<tr>
					<td>Angkatan</td><td>: <?php echo Angkatan::model()->findByPk($user->angkatan_id)->angkatan; ?></td>
				</tr>
				<tr>
					<td>Agama</td><td>: <?php echo Agama::model()->findByPk($user->agama_id)->agama; ?></td>
				</tr>
				<tr>
					<td>Email Aktif</td><td>: <?php echo $user->email==null ? "<span class='null'>Tidak diset</span>" : $user->email; ?></td>
				</tr>
				<tr>
					<td>Nomor HP</td><td>: <?php 
						$dbh=Yii::app()->db;
						$sql="select nomorHp from nomorhp where user_id=".$user->id;
						$command=$dbh->createCommand($sql);
						$reader=$command->query();
						if($reader->getRowCount()!=0){
							while(($row=$reader->read())!==false){
								echo $row['nomorHp'].", ";
							}
						}else{
							echo "<span class='null'>Tidak diset</span>";
						}
					?></td>
				</tr>
				<tr>
					<td>Asal Daerah</td><td>: <?php echo $user->asalDaerah; ?></td>
				</tr>
				<tr>
					<td style="padding-top:5px;">Media Sosial</td><td><?php 
						$dbh=Yii::app()->db;
						$sql="select judul,isi from mediasosial where user_id=".$user->id." order by judul";
						$command=$dbh->createCommand($sql);
						$reader=$command->query();
						if($reader->getRowCount()!=0){
							echo "<ol>";
							while(($row=$reader->read())!==false){
								echo "<li>".$row['judul'] ." : ". $row['isi']." </li>";
							}
							echo "</ol>";
						}else{
							echo ": <span class='null'>Tidak diset</span>";
						}
					?></td>
				</tr>
			</table>
		</div>
		<div class="clear"><br/><hr/></div>
	<?php endforeach; ?>
	</div>
</div>